package com.atguigu.gmall.task.scheduled;

import com.atguigu.gmall.common.constant.MqConst;
import com.atguigu.gmall.common.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @program: gmall-parent
 * @author: Mr.Zhuo
 * @create: 2022-04-24 17:40
 **/
@EnableScheduling
@Component
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    /**
     * 每天凌晨1点执行
     */
    @Scheduled(cron = "0/10 * * * * ?")
    //@Scheduled(cron = "0 0 1 * * ?")
    public void task1() {

        //System.out.println("大傻子=====================");

        rabbitService.send(MqConst.EXCHANGE_DIRECT_TASK,  MqConst.ROUTING_TASK_1, "");
    }

}
